/*  SSEventLinkObject.h
 *  MESLib
 * 
 * Copyright 2003-2009 Starline Software Ltd
 * 
 * This file is part of MESLib.
 * 
 * MESLib is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MESLib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with MESLib. If not, see <http://www.gnu.org/licenses/>.
 */
//  Created by Tobias Haughton on Sat Jan 25 2003.
//  Copyright (c) 2003 Starline Software. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "SSNeedsDiamond.h"
#import "math.h"
#import "SSConst.h"

@class SSEventObject;

@interface SSEventLinkObject : NSObject<NSCoding> {
   NSPoint startPoint;
   NSPoint endPoint;
   NSBezierPath *thePath;
   NSPoint arrowPoint1;
   NSPoint arrowPoint2;
   NSPoint tentativeStringPoint;
   NSBezierPath *arrowPath;
   SSEventObject *linkedFrom;
   SSEventObject *linkedTo;
   NSNumber *linkType;
   NSAttributedString *tentativeString;
   NSMutableArray *needsDiamondArray;
   BOOL isSelected;
}

- (id)initWithLinkedFrom:(SSEventObject *)from linkedTo:(SSEventObject *)to type:(NSNumber *)type;

- (void)setPoints;
- (void)setPointsForMatrixDisplay;
- (void)setPointsForOverlapDisplay;
- (void)setArrows;
- (SSEventObject *)linkedFrom;
- (SSEventObject *)linkedTo;
- (void)setLinkedFrom:(SSEventObject *)object;
- (void)setLinkedTo:(SSEventObject *)object;
- (void)removeLinkTo;
- (void)update;
- (void)setPaths;

- (NSNumber *)linkType;
- (void)setLinkType:(NSNumber *)type;
- (void)changeLinkTypeTo:(NSNumber *)t;
- (NSString *)linkTypeString;

   //these are used to move the arrow a few pix away from the object that is being connected to
- (NSPoint)moveUp:(NSPoint)p;
- (NSPoint)moveDown:(NSPoint)p;
- (NSPoint)moveLeft:(NSPoint)p;
- (NSPoint)moveRight:(NSPoint)p;

- (void)stroke;

- (void)changeLinkType;
   
- (NSMutableArray *)needsDiamondArray;
- (void)setNeedsDiamondArray:(NSMutableArray *)array;
- (void)addNeedsDiamond:(SSNeedsDiamond *)diamond;
- (void)removeNeedsDiamond:(SSNeedsDiamond *)diamond;
- (NSPoint)positionForNeedsDiamond:(SSNeedsDiamond *)diamond;

- (BOOL)isFullyWithinRect:(NSRect)rect;
- (BOOL)containsPoint:(NSPoint)point;

- (BOOL)isSelected;
- (void)setSelected;
- (void)setUnselected;


@end
